﻿#include "sos.h"

#include<reg52.h>
#include<stdio.h>

void seriral_init(void)
{
	SCON = 0X52;
	TMOD = 0X21;
	TH1 = 0XF3;
	TR1 = 1;
}

void task0()
{
	while(1)
	{
		printf("task0 \n");
		SOS_TaskSuspend(0);
		printf("back in task0... \n");
		SOS_TaskSuspend(1);
		SOS_TaskSuspend(0);
		SOS_Delay();
	}
}

void task1()
{
	while(1)
	{
		printf("task1 \n");
		SOS_TaskResume(0);
		SOS_Delay();
	}
}

void task2()
{
	while(1)
	{
		printf("task2... \n");
		SOS_TaskResume(1);
		SOS_Delay();
	}
}

int main(void)
{
	seriral_init();
	//printf("begin... \n");
	//printf("init...\n");
	SOS_TaskCreate(task0,0);
	SOS_TaskCreate(task1,1);
	SOS_TaskCreate(task2,2);
	
	SOS_Start();
	
}

